/*
Written by Best Flash Solutions, Inc  
See:
	http://www.bestflashsolutions.com
Contact me: contact@bestflashsolutions.com
*/

/**
 * Manage application information
 */
package
{
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	
	public class MyObject
	{
		public static const MAX_ROW: int = 2;
		public static const PADDING: int = 10;
		//Autoarrange video windows
		public var autoArrange: Boolean = false;
		
		//Max joiners allowed in room
		public var maxJoiner: int = 4;
		public var username: String = "";
		public var password: String = "";
		public var permission: String = "";
		public var roomID: int;
		public var roomGUID: String = "";
		public var roomName: String = "";
		public var roomDescription: String = "";
		public var isCreator:Boolean = false;
		//position of current user
		public var iPosition: int = 0;
		//room's creator name
		public var creator: String = "";
		//list joiners		
		public var lstJoiner: ArrayCollection = new ArrayCollection();
		public var lstJoinerFull: XML;
		public var lstVideoDisplay: ArrayCollection = new ArrayCollection();
		public var iTotalAvailable: int = 0;
		public var sPHPRequest: String = "PHPScripts/roommanager.php";
		public var bProcessNotify: Boolean = false;
		
		public function init()
		{
			iPosition = -1;
			var i: int;
			for (i=0; i<maxJoiner; i++) {
				lstJoiner.addItem("");
			}
					
		}

		//empty stream name
		public function emptyStreamName() {
			var i: int;
			for (i=0; i<maxJoiner; i++) {
				lstJoiner[i]="";
			}		
		}
		
		//Finf joiner information in room
		public function findRoomJoiner(joinerName: String): XML {
			for each (var objJoiner: XML in lstJoinerFull.joiner) {
				if (objJoiner.toString()==joinerName) {
					return objJoiner;
				}
			} 
			return null;
			
		}
	}
}